Skip to content

Port the history rewrite tool out of drover as a standalone binary - #2

Merged
jirathip-k merged 1 commit into
stagingfrom
issue-1
Nov 21, 2026
Merged

jirathip-k merged 1 commit into
stagingfrom
issue-1

Conversation

@jirathip-k

Copy link
Copy Markdown
Contributor

Closes #1

For humans

  • The history fresh-start tool (one root before a cut, one commit per landed PR, private archive, undo) now lives here as its own program, no longer inside drover.
  • It does the same thing it did in drover: the same plan, the same two separate owner run cards for the line and for main, and the same refusals.
  • Drover hands over its folders, fleets and saved ids as arguments. The tool uses drover's own commands to post cards and to check that the run is the approved one.

What changed

  • src/plan.rs is copied verbatim from drover's compact/plan.rs. src/write.rs and src/push.rs are ported off drover's Runner onto plain processes. src/main.rs holds the CLI, readiness, cards, report and reset.
  • The only dependencies are anyhow, clap, serde and serde_json, all of which drover already uses.
  • tests/compact.rs ports drover's crates/cli/tests/compact.rs sim end to end: the real binary and real git, with fake gh and drover on PATH. It adds lane-folder, check-lane, spent-card and date-cut cases.
  • README (install, use, how drover's run card calls it) and .github/workflows/ci.yml (fmt, clippy -D warnings, tests). .gitignore has /target*/.

Decisions

At 39407e8e6, drover's CLI exposes none of its event log, so the drover-state parts work like this:

  • Card approval (COMPACT_UNAPPROVED): --push reads drover thread show <thread> --json. A card with exactly its command must have drover's "approved by owner, running in" line and no "ran in" line. The card command therefore carries --thread.
  • Check lanes: --fleet <name> reads drover status <fleet> --json for review or verify states.
  • Lane folders: --lane [host:]path. A lane is "dirty" when it has tracked changes or unpushed commits. Untracked files don't count: reset --keep never touches them, and drover's own lane files are untracked.
  • Saved-SHA remap: --saved takes drover's stored ids as a TSV. The dry run prints the same "events" lines, and the push writes moved.json (and an undo writes undone) for drover to log as its compacted / compact-undone records. The list of which fields are saved (SAVED/KEPT) and its source-scan CI guard scan drover's own sources, so they stay in drover and belong to the follow-up removal issue.
  • Fleet paused: this is a fleet.toml fact that no drover CLI exposes. The check is not ported, and the README says to run drover pause first.
  • crates/cli/tests/compaction.rs tests drover's event-log archiving (archive-events), not this tool, so it was not ported.

Evidence (head fafb193)

  • cargo fmt --check → exit 0
  • cargo clippy --locked --all-targets -- -D warnings → exit 0
  • cargo test --locked → exit 0 (2 passed)
  • Same plan as drover: I ran drover's own sim test at 39407e8e6 (exit 0) with its dry-run output and fixture repo dumped, then ran this binary's --cut <sha> --dry-run on that same repo. diff drover.out compact.out → exit 0, byte-identical, every sha included.

src/ net +1498 (budget: none stated): it ports drover's 1474 lines plus the argument and drover-CLI plumbing.

@jirathip-k
jirathip-k merged commit ad17f1e into staging Nov 21, 2026
2 checks passed
@jirathip-k
jirathip-k deleted the issue-1 branch November 21, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant